<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <h1>{{msg}}</h1>
        <button @click="change">点击更改值</button>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                msg: "vue"
            },
            methods: {
                aaa() {
                    console.log("方法运行");
                },
                change() {
                    this.msg = "我是更改后的值"
                }
            },
            beforeCreate() {
                console.log("beforeCreate");
                console.log(this.$el);
                console.log(this.$data);
                this.aaa();
            },
            created() {
                console.log("created");
                console.log(this.$el);
                console.log(this.$data);
                this.aaa();
            },
            beforeMount() {
                console.log("beforeMount");
                console.log(this.$el);
                console.log(this.$data);
                this.aaa();
            },
            mounted() {
                console.log("mounted");
                console.log(this.$el);
                console.log(this.$data);
                this.aaa();
            },
            beforeUpdate() {
                console.log("beforeUpdate");
            },
            updated() {
                console.log("updated");
            },
            beforeDestroy() {
                console.log("beforeDestroy");
                console.log(this.$el);
                console.log(this.$data);
                this.aaa();
            },
            destroyed() {
                console.log("destroyed");
                console.log(this.$el);
                console.log(this.$data);
                this.aaa();
            }
        });
        setTimeout(() => vm.$destroy(), 3000);
    </script>
</body>

</html>